//
//  WBProfileViewController.swift
//  微博Demo
//
//  Created by 花化华 on 2016/11/22.
//  Copyright © 2016年 itcast. All rights reserved.
//

import UIKit
let logoutSuccessNotification = "logoutSuccessNotification"

class WBProfileViewController: WBBaseViewController {
    
    override func viewDidLoad() {
        super.viewDidLoad()
    }

    override func loadData() {
        super.loadData()
        if WBUserAccount.shared.isLogin{
            navItem.rightBarButtonItem = UIBarButtonItem(title: "注销", style: .plain, target: self, action: #selector(logout))
        }
    }
    
    /// 注销
    @objc fileprivate func logout() {
        WBUserAccount.shared.removeUserInfo()
        navItem.rightBarButtonItem = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
        NotificationCenter.default.post(name: NSNotification.Name(rawValue: logoutSuccessNotification), object: nil)
    }

}
